package trb.complexshield.bool.distance;

import no.hrp.hvrc.utils.j3d.Vec3;

import java.util.List;

/**
 * Created by admin on 20/05/14.
 */
public class OrDistance implements  DistanceProducer {

    private List<DistanceProducer> producerList;

    public OrDistance(List<DistanceProducer> producerList) {
        this.producerList = producerList;
    }

    @Override
    public float getDistance(Vec3 pos) {
        float minDistance = Float.MAX_VALUE;
        for (DistanceProducer distanceProducer : producerList) {
            minDistance = Math.min(minDistance, distanceProducer.getDistance(pos));
        }

        return minDistance;
    }
}
